<template>
  <s-table
    bordered
    ref="table"
    :row-key="(record) => record.cb_id"
    :columns="businessColumns"
    :data="businessData"
    :scroll="{ y: 380 }"
  >
    <template slot="action" slot-scope="text, record">
      <a-button type="link" @click="$router.push({ name: 'BusinessDetail', params: { id: record.cb_id } })">查看</a-button>
    </template>
  </s-table>
</template>

<script>
import { STable } from '@/components'
import { getCustomerBusiness } from '@/api/customer'
import col from '@/columns/customer'
const businessColumns = col.business

export default {
  components: {
    STable
  },
  props: {
    keys: {
      type: String,
      default: ''
    }
  },
  name: 'BusinessInfo',
  data () {
    return {
      businessColumns,
      businessLoading: true,
      queryParam: {},
      businessData: parameters => {
        return getCustomerBusiness(Object.assign(parameters, this.queryParam)).then(res => {
          return res.result
        })
      }
    }
  },
  created () {
    this.queryParam['filter[customer_id]'] = this.keys
    this.businessLoading = false
  }
}
</script>

<style scoped>

</style>
